<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>

<body>
    <div id="app">
        <input type="button" value="按钮" @click="show()">
        <input type="button" value="按钮" @click="number++">
        {{number}}

        <!-- 条件渲染 当满足条件式显示指定的内容
        v-if ="boolean表达式" -->
        <h2 v-if="number == 0">mysql</h2>
        <h2 v-else-if="number == 1">html</h2>
        <h2 v-else>啥也不是</h2>
        <hr>
        <h2 v-show="number == 0">mysql</h2>
        <h2 v-show="number == 1">html</h2>

        <!-- 
            v-if主要操作的是移除和添加html标签 不利于频繁切换
            v-show主要通知的是html标签的隐藏和显示 适用于频繁切换

         -->

        <div style="width: 100px; height: 100px; display: block;">55555</div>
    </div>

</body>

</html>

<script>
    new Vue({
        el: '#app',
        data: {
            name: '王五',
            number: 0
        },
        //定义函数的位置
        methods: {
            //函数
            show() {
                alert("我是提示信息");
            }
        }
    });
</script>